import userId from './userId';
import * as Channel from './channel';
import analytics from '@react-native-firebase/analytics';

export const onEvent = async (
    id: string, data?: any
) => {
    const channel = (
        await Channel.getChannel()
    )

    const _default = {
        channel:channel,
        appUserId:userId()
    }

    const params = {
        ...data,
        ..._default
    }

    analytics().logEvent(id,params);
}

export const events = {
    '用户登录':`login`,
    '用户注册':`sign_up`,
    'app启动':`app_launch`,
    '支付返回成功':`pay_success`,
    '点击支付按钮':`click_pay_btn`,
    '后端返回支付成功':`pay_result_success`,
    '后端返回支付失败':`pay_result_fail`
}

